//
//  IntegralConllectionViewCell.m
//  Base_App
//
//  Created by Yutian Duan on 2019/6/4.
//  Copyright © 2019年 Wanwin. All rights reserved.
//

#import "IntegralConllectionViewCell.h"

@implementation IntegralConllectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
  if (self = [super initWithFrame:frame]) {
    [self addSubviews];
  }
  return self;
}

- (void)addSubviews {
  
  _classLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 100, 30)];
  _classLabel.textAlignment = NSTextAlignmentLeft;
  _classLabel.textColor = [UIColor blackColor];
  _classLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16.0f];
  _classLabel.text = YTLocalizedString(@"HBC独家礼遇");
  [self.contentView addSubview:_classLabel];
  
  
  //!
  UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, self.bounds.size.width, self.bounds.size.height - 50)];
  bgView.layer.cornerRadius = 8;
  bgView.layer.masksToBounds = YES;
  bgView.backgroundColor = [UIColor whiteColor];
  [self.contentView addSubview:bgView];
  
  self.imageIV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, bgView.yt_width, bgView.yt_width * IMAGEPRO)];
  [bgView addSubview:self.imageIV];
  
  self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, self.imageIV.yt_bottom, bgView.yt_width - 20 -100, 30)];
  self.titleLabel.textAlignment = NSTextAlignmentLeft;
  self.titleLabel.textColor = [UIColor blackColor];
  self.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16.0f];
  self.titleLabel.text = @"无敌$40洗车劵";
  [bgView addSubview:self.titleLabel];

  //!
  self.noteImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, self.titleLabel.yt_bottom, 40, 20)];
  self.noteImageView.image = [UIImage imageNamed:@"Home_timeLimit"];
  [bgView addSubview:self.noteImageView];
  
  self.noteLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.noteImageView.yt_right + 10, self.noteImageView.yt_top, bgView.yt_width - self.noteImageView.yt_right - 20, self.noteImageView.yt_height)];
  self.noteLabel.font = [UIFont systemFontOfSize:14];
  self.noteLabel.text = YTLocalizedString(@"著数及入油记录一览无遗");
  self.noteLabel.textAlignment = NSTextAlignmentLeft;
  self.noteLabel.textColor = DEF_GRAY;
  [bgView addSubview:self.noteLabel];

  
  ///!
  UIView *priceView = [[UIView alloc] initWithFrame:CGRectMake(self.titleLabel.yt_right, self.titleLabel.yt_top, 100, bgView.yt_height - self.titleLabel.yt_top)];
  [bgView addSubview:priceView];
  
  _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, priceView.yt_width, priceView.yt_height/2)];
  _priceLabel.font = [UIFont systemFontOfSize:15];
  _priceLabel.textAlignment = NSTextAlignmentCenter;
  _priceLabel.textColor = DEF_GRAY;
  _priceLabel.text = @"7,500pt.";
  [priceView addSubview:_priceLabel];
  
  _exchangeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, _priceLabel.yt_bottom, _priceLabel.yt_width, _priceLabel.yt_height)];
  [_exchangeButton setTitle:YTLocalizedString(@"立即兑换") forState:UIControlStateNormal];
  [_exchangeButton setTitleColor:DEF_GRAY forState:UIControlStateNormal];
  _exchangeButton.titleLabel.font = [UIFont systemFontOfSize:12];
  [priceView addSubview:_exchangeButton];


}

@end
